package com.atmc.controller;

import com.atmc.bean.Bill;
import com.atmc.service.BillService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class BillController {
    @Autowired
    BillService billService;
    //添加一条账单记录
    @RequestMapping("/articleadd")
    public String articleadd(){

        return "bill/articleadd";
    }

    //查询一个账单记录
    @RequestMapping("/tobillselectOne")
    public String tobillselectOne(@RequestParam("goods_name")String goods_name,Model model){
        Bill list = billService.selectOne(goods_name);
        model.addAttribute("msg",list);
        return "bill/article-list";
    }
    //详细查询
    @RequestMapping("/tobilldetails/{goods_name}")
    public String tobilldetails(@PathVariable("goods_name")String goods_name,Model model){
        Bill bill = billService.selectOne(goods_name);
        model.addAttribute("bill",bill);
        return "bill/billDetail";
    }

}
